#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
    vector<string> buildArray(vector<int>& target, int n) {
        stack<int> st;
        string s1="Push";
        string s2="Pop";
        int m=target.size();
        vector<int> vec;
        vector<string> ret;
        int count=1;
        int idx=0;
        while(count<=n&&idx<m)
        {
            
            st.push(count);
            ret.push_back(s1);
            if(vec==target) return ret;
            if(st.top()!=target[idx])
            {
                st.pop();
                ret.push_back(s2);
            }
            else idx++;
            count++;
        }
        return ret;
    }
};